package com.walk.zworld.ui.activity


import android.graphics.Bitmap
import android.os.Bundle
import android.util.Log
import android.view.View
import android.widget.ImageView
import androidx.appcompat.app.AppCompatActivity
import com.base.lib.base.view.BaseActivity
import com.tencent.map.geolocation.TencentLocationManager
import com.tencent.tencentmap.mapsdk.maps.TencentMapInitializer
import com.walk.zworld.R
import com.walk.zworld.ui.location.LocationDetailFragment
import com.walk.zworld.ui.location.MyDetailFragment
import com.walk.zworld.view.location.tenbean.LocationSelectorConstants

class MyDetailActivity : BaseActivity() {

    override fun onBindLayout(): Int = R.layout.location_activity_main

    override fun initView() {
        setTop("我的")
        val transaction = supportFragmentManager.beginTransaction()
        supportFragmentManager.setFragmentResultListener(
            LocationSelectorConstants.REQUEST_KEY, this
        ) { _, bundle ->
            val result = bundle.getString(LocationSelectorConstants.RESULT_KEY)
            Log.i("LocationDetailActivity", result ?: "NULL")
        }
        transaction.replace(R.id.fl_map_container, MyDetailFragment())
        transaction.commitNow()
    }

    override fun initData() {
        zxingCodeUrl = findViewById<View>(R.id.zxingCodeUrl) as ImageView
        zxingCodeUrl?.setOnClickListener(View.OnClickListener { zxingCodeUrl!!.setVisibility(View.GONE) })
    }
    private var zxingCodeUrl: ImageView? = null
    fun toShowChargeUrl(qrCode: Bitmap) {
        zxingCodeUrl?.setImageBitmap(qrCode)
        zxingCodeUrl?.setVisibility(View.VISIBLE)
    }

}